﻿using System;
using System.Linq.Expressions;

namespace DotNetRepository
{
    public class EntityCollectionArgs<TEntity>
        where TEntity : class, IEntity
    {
        public IEntity Container;
        public Expression<Func<TEntity, bool>> Association;
        public Action<TEntity, IEntity> SetForeignKey;

        public string ForeignKey;

        /// <summary>
        /// When provided, this action overrides any SetForeignKey action when an entity
        /// is added to the collection.
        /// </summary>
        public Action<TEntity> Bind;

        /// <summary>
        /// When provided, this action overrides any SetForeignKey action when an entity
        /// is removed from the collection
        /// </summary>
        public Action<TEntity> UnBind;

        public bool DeleteOnRemove = true;
    }
}
